﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Happy.ExtentionMethods;

namespace Happy.ExceptionHanding
{
    /// <summary>
    /// 泛型版本异常信息提供者。
    /// </summary>
    public abstract class ExceptionInformationProvider<TException> : IExceptionInformationProvider
        where TException : Exception
    {
        /// <inheritdoc />
        public object CreateInformation(Exception exception)
        {
            exception.MustNotNull("exception");

            return this.CreateResult(exception as TException);
        }

        /// <inheritdoc />
        protected abstract object CreateResult(TException exception);
    }
}
